#!/sbin/openrc-run
supervisor="supervise-daemon"

# fallback values for /etc/conf.d/lazymc
: ${command_user:=lazymc:lazymc}
: ${logdir:=/var/log/lazymc}
: ${_conf_path:=/etc/lazymc.toml}

name=lazymc
description="Put your Minecraft server to rest when idle"
command="/usr/bin/lazymc"
command_args="-c $_conf_path"
command_background=true

pidfile="/run/$name.pid"
output_log="$logdir/output.log"
error_log="$logdir/error.log"

depend() {
	need net
	use logger
}

start_pre() {
	checkpath -d -o "$command_user" "$logdir"
	checkpath -f -o "$command_user" "$output_log" "$error_log"
}
